import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
  CreateDateColumn,
} from 'typeorm';

@Entity({ name: 'tb_permissions' })
export class Permission {
  @PrimaryGeneratedColumn('increment', {
    name: 'permission_id',
    type: 'bigint',
    comment: '权限ID 主键',
    primaryKeyConstraintName: 'permission_id',
  })
  permission_id: number;

  @Column({
    name: 'permission_name',
    type: 'varchar',
    length: 255,
    unique: true,
    nullable: true,
    comment: '权限名称（唯一）',
  })
  permission_name: string;

  @Column({
    name: 'description',
    type: 'text',
    nullable: true,
    comment: '权限描述',
  })
  description: string;

  @UpdateDateColumn({
    name: 'updated_at',
    type: 'timestamp',
    comment: '最后一次更新时间',
  })
  updated_at: number;

  @CreateDateColumn({
    name: 'created_at',
    type: 'timestamp',
    comment: '创建时间',
  })
  created_at: number;
}
